package com.ruoyi.wareManagement.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.wareManagement.domain.InventoryQueryChecked;
import com.ruoyi.wareManagement.service.IInventoryQueryCheckedService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 待检库存查询Controller
 * 
 * @author admin
 * @date 2024-06-28
 */
@RestController
@RequestMapping("/wareManagement/inventoryQueryChecked")
public class InventoryQueryCheckedController extends BaseController
{
    @Autowired
    private IInventoryQueryCheckedService inventoryQueryCheckedService;

    /**
     * 查询待检库存查询列表
     */
    @PreAuthorize("@ss.hasPermi('wareManagement:inventoryQueryChecked:list')")
    @GetMapping("/list")
    public TableDataInfo list(InventoryQueryChecked inventoryQueryChecked)
    {
        startPage();
        List<InventoryQueryChecked> list = inventoryQueryCheckedService.selectInventoryQueryCheckedList(inventoryQueryChecked);
        return getDataTable(list);
    }

    /**
     * 导出待检库存查询列表
     */
    @PreAuthorize("@ss.hasPermi('wareManagement:inventoryQueryChecked:export')")
    @Log(title = "待检库存查询", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, InventoryQueryChecked inventoryQueryChecked)
    {
        List<InventoryQueryChecked> list = inventoryQueryCheckedService.selectInventoryQueryCheckedList(inventoryQueryChecked);
        ExcelUtil<InventoryQueryChecked> util = new ExcelUtil<InventoryQueryChecked>(InventoryQueryChecked.class);
        util.exportExcel(response, list, "待检库存查询数据");
    }

    /**
     * 获取待检库存查询详细信息
     */
    @PreAuthorize("@ss.hasPermi('wareManagement:inventoryQueryChecked:query')")
    @GetMapping(value = "/{checkedId}")
    public AjaxResult getInfo(@PathVariable("checkedId") Long checkedId)
    {
        return success(inventoryQueryCheckedService.selectInventoryQueryCheckedByCheckedId(checkedId));
    }

    /**
     * 新增待检库存查询
     */
    @PreAuthorize("@ss.hasPermi('wareManagement:inventoryQueryChecked:add')")
    @Log(title = "待检库存查询", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody InventoryQueryChecked inventoryQueryChecked)
    {
        return toAjax(inventoryQueryCheckedService.insertInventoryQueryChecked(inventoryQueryChecked));
    }

    /**
     * 修改待检库存查询
     */
    @PreAuthorize("@ss.hasPermi('wareManagement:inventoryQueryChecked:edit')")
    @Log(title = "待检库存查询", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody InventoryQueryChecked inventoryQueryChecked)
    {
        return toAjax(inventoryQueryCheckedService.updateInventoryQueryChecked(inventoryQueryChecked));
    }

    /**
     * 删除待检库存查询
     */
    @PreAuthorize("@ss.hasPermi('wareManagement:inventoryQueryChecked:remove')")
    @Log(title = "待检库存查询", businessType = BusinessType.DELETE)
	@DeleteMapping("/{checkedIds}")
    public AjaxResult remove(@PathVariable Long[] checkedIds)
    {
        return toAjax(inventoryQueryCheckedService.deleteInventoryQueryCheckedByCheckedIds(checkedIds));
    }
}
